<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <!-- v-if -->
      <!-- <div v-if="loginType == 'phone'">
        <label for="">
          手机:
        </label>
        <input type="text" placeholder="请输入手机号">

      </div>
      <div v-else>
        <label for="">email</label>
        <input type="text" placeholder="请输入邮箱">
      </div> -->

      <!-- v-show -->
      <div v-show="loginType == 'phone'">
        <label for="">
          手机:
        </label>
        <input type="text" placeholder="请输入手机号">

      </div>
      <div v-show="loginType == 'email'">
        <label for="">email</label>
        <input type="text" placeholder="请输入邮箱">
      </div>


      <button @click="change()">切换登录方式</button>

    </div>

    

    <script src="../js/vue.js"></script>

    <script>
      const app = Vue.createApp({
        data() {
          return {
            loginType: "phone"
          }
        },
        methods: {
          change (){
            this.loginType = this.loginType == 'phone' ? this.loginType = 'email' : 'phone';
          }      
        }
      }).mount("#app");
    </script>
  </body>
</html>